var httpSvc = require("./httpSvc");
var cf = require("../utils/config");
var q = require("querystring");
/*
* 请求规范
* @param d  json     请求数据
* @param h  json     请求头
* @param cb function callback函数
*
* */
//乐娱-我的数据
exports.myData = function(d,h,cb){
    var path =cf.path_game+"/myData?"+q.stringify(d);
    console.log(path)
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("乐娱-我的数据：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("乐娱-我的数据：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//乐娱-我的商品列表
exports.myProduct = function(d,h,cb){
    var path =cf.path_game+"/myProduct?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("乐娱-我的商品列表：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("乐娱-我的商品列表：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};
//乐娱-我的优惠券列表
exports.myNormalCoupon = function(d,h,cb){
    var path =cf.path_game+"/myNormalCoupon?"+q.stringify(d);
    var opt = httpSvc.makeOpt(cf.server_host,cf.server_port, path, "post");
    httpSvc.httpReq(opt, function (b) {
        if (b.json.code !=0) {
            global.logerror("乐娱-我的优惠券列表：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + (b.body ));
        } else {
            global.loginfo("乐娱-我的优惠券列表：" + JSON.stringify(opt) + " .posts. " + JSON.stringify(d) + " .back. " + b.body);
        }
        cb(b)
    }, d);
};